package com.shuai.dynamicProxy.cglib.proxy;

import com.shuai.staticProxy.service.UserService;
import org.springframework.cglib.proxy.Callback;
import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.MethodInterceptor;

import java.util.Calendar;

/**
 * @author shuaihong-coding
 * @date 2025/10/3
 * @className JdkDynamicProxyFactory
 */
@SuppressWarnings("all")
public class CjlibDynamicProxyFactory {

    public static <T> T getProxy(Class<T> targetClass, MethodInterceptor interceptor) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(targetClass);
        enhancer.setCallback(interceptor);
        return (T) enhancer.create();
    }
}
